<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
	    <meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>牛股推荐</title>
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/weChat/css/style.css"/>
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/weChat/css/reset.css"/>
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/weChat/css/base.css"/>

		<style type="text/css">
			.popup_inner{    width: 50%;
				height: auto;
				background: #fff;
				text-align: center;
				margin: 40% auto;}
		</style>
	</head>
	<body >
	<?php
		$arr = [];
		foreach($result as $v) $arr[date('Y-m-d',$v['recommend_time'])][] = $v;
	?>
		<div class="wrapper" id="wrapper" style="height:100vh;">
			<div class="Recommend-niugu">
	             <p class="niugu-p bg"><img class="iocn-top" src="__PUBLIC__/weChat/images/iocn_top@2x.png"/><span class="dis_in niugu-sp">今日推荐</span></p>
	             <div class="niugu-news-box">
					 <?php $todayArr = empty($arr[date('Y-m-d',time())]) ? [] : $arr[date('Y-m-d',time())];?>
					 <?php foreach($todayArr as $k => $v){?>

		             <div class="niugu-news b_btm bg">
		             	<div class="news-content">
			             	<p class="news-content-p"><span class="news-content-sp1 d"><?php echo $k == 0 ? $v['shares_name'] : ($v['is_reading'] == 1  ? $v['shares_name'] : mb_substr($v['shares_name'],0,1,'utf-8').'***********')?> </span><span onclick="lookRecommend(this)" data-id="<?php echo $v['shares_id']?>"><?php echo $k ==0  || $v['is_reading'] == 1 ?  ''  : '查看'?></span>
								<span class="news-content-sp2 font4 fr dis_in">推荐时间:<span><?php echo date('Y-m-d',$v['recommend_time'])?></span></span>
							</p>
			             	<p class="news-content-p1 font1"><?php echo $k == 0 ? $v['introduce'] :($v['is_reading'] == 1  ? $v['introduce'] : mb_substr($v['introduce'],0,10,'utf-8').'***********');?>

							</p>
		             	</div>
		             </div>
					 <?php }  ?>
	             </div>	
	             <div class="History-box">
	             	<div class="Dividing-line">
	             		<img class="icon-fgx" src="__PUBLIC__/weChat/images/tzgw_fgx@3x.png"/>
	             		<p class="history font3"><img class="icon-tt" src="__PUBLIC__/weChat/images/icon_sj@2x.png"/>历史推荐</p>
	             	</div>
	                <div class="list bg">
	                	<div class="list-con">
		                	<ul class="list_ul font1 b_btm">
		                		<li class="li_lef">名称代码</li>
		                		<li >推荐时间</li>
		                		<li class="li_right">推荐理由</li>
		                	</ul>
		                	<div class="tab font1">
		                		<table class="tabl">
									<?php foreach($arr as $k=>$v1){
									$time = date('Y-m-d',time());
									if($k == $time){continue;}
									?>
									<?php foreach($v1 as $v2){?>
		                			<tr class="tabl-tr b_btm"><td class="td_1"><span><?php echo $v2['shares_name']?></span>
										<span class="font3 f3">600292</span></td><td><?php echo date('Y-m-d',$v2['recommend_time'])?></td><td class="look"><span class="spa_btn" onclick="lookOne(this)" data-id="<?php echo $v2['shares_id']?>">查看</span></td></tr>
									<?php } ?>
									<?php } ?>
		                		</table>          
		                	</div>	                		
	                	</div>

	                	
	                </div>	             	
	             </div>
			
			</div> 
            <!--推荐理由-->
            <div id="background1" ></div>
            <div id="content3">
            	<div class="delete"><img class="icon-del" src="__PUBLIC__/weChat/images/icon_c@2x.png"/></div>
                <div class="reason bg">
                	<p class="reason-p b_btm">推荐理由</p>
                	<p class="reason-p1 dis_b font3"></p>
                </div>            	
            </div>
		</div><!--wrapper-->
		<div class="popup hide1" id="content6">
			<div class="popup_inner">
				<div class="popup_content">本次操作扣除<span><?php echo $deduct_integral?></span>积分</div>
				<button class="btn" onclick="lookRecommendSure()">确定</button>
			</div>
		</div>
	<div id="error" class="hide1 popup error">
		<div class="popup-inner">
			<img class="close" data-name="error" src="__PUBLIC__/home/images/icon_delete1.png" />
			<div class="errorImg"><img  src="__PUBLIC__/home/images/icon_sb.png"></div>
			<div class="msg" id="errmsg"></div>
		</div>
	</div>
	<div id="suc" class="hide1 popup error">
		<div class="popup-inner">
			<img class="close" data-name="error" src="__PUBLIC__/home/images/icon_delete1.png" />
			<div class="errorImg"><img  src="__PUBLIC__/home/images/icon_cg.png"></div>
			<div class="msg" id="sucmsg"></div>
		</div>
	</div>
		<script src="__PUBLIC__/weChat/js/jquery-2.2.2.js" type="text/javascript" charset="utf-8"></script>
		<script src="__PUBLIC__/weChat/js/base.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
		function seeing(){
			var see=$('.spa_btn');
			for(var i=0;i<see.length;i++){
				$('#background1').show();$('#content3').show();
				return false;
			}
		}
         $('.icon-del').click(function(){$('#background1').hide();$('#content3').hide();});
		function lookRecommendSure(){
			var recommendId= $("#content6").attr("data-id");
			$.ajax({
				url:"http://zbstest.guochengic.com/home/integral/readShare",
				type:"POST",
				data:{
					"shares_id":recommendId
				},
				success: function (res) {
					console.log(res)
					if(res.code==0){
						location.reload();
					}else {
						$("#error").show();
						$("#errmsg").html(res.msg);
						errorHide();
						return;
					}
				}
			});
		};
		</script>
	</body>
</html>